package cn.bugstack.mybatis.builder;

import cn.bugstack.mybatis.mapping.ResultMap;
import cn.bugstack.mybatis.mapping.ResultMapping;

import java.util.List;

/**
 * @author wcc
 * @description 结果映射解析器
 * @create
 */

public class ResultMapResolver {
    private final MapperBuilderAssistant assistant;
    private String id;
    private Class<?> type;
    private List<ResultMapping> resultMappings;

    public ResultMapResolver(MapperBuilderAssistant assistant, String id, Class<?> type, List<ResultMapping> resultMappings) {
        this.assistant = assistant;
        this.id = assistant.applyCurrentNamespace(id, false);
        this.resultMappings = resultMappings;
        this.type = type;
    }
    public ResultMap resolve(){
        return assistant.addResultMap(id, type, resultMappings);
    }

}
